var express = require('express')
var app = express()

// 配置接口跨域访问
var cors = require('cors')
const corsConfig = {
    credentials: true,
    origin: true,
}
app.use(cors(corsConfig))

app.get('/zeus/api/user/info', function (req, res) {
    // 设置cookie
    res.cookie('bbs', 'tokentest', {
        // 设置该Cookie只可以由服务端访问，即前端JavaScript无法访问document.cookie获取该值，但控制台还是可以查看和修改
        httpOnly: true,
        path: '/',
        maxAge: 14 * 86400000,
    })

    res.send({
        "code": "1",
        "msg": "success",
        "data": {
            "userEmail": "t17@bb",
            "userId": 17,
            "userName": "yangkang1111",
            "userStatus": 1,
            menus: []
        },
        "success": true,
        "total": null
    })
})

app.listen(3000)
console.log('Listening on port 3000...')